package com.jiai.live.api;


import com.jiai.base.config.Config;
import com.jiai.core.tools.RestResultGenerator;
import com.jiai.exception.ServiceException;
import com.jiai.live.service.LiveGiftService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Administrator on 2017/3/28.
 */
@SuppressWarnings("SpringJavaAutowiringInspection")
@RequestMapping("/api/v1/live/gift")
@RestController
public class LiveGiftAPIContller {
    @Autowired
    private LiveGiftService liveGiftService;
    @Autowired
    private Config config;


    /**
     * 加载全部礼物
     * @return
     * @throws ServiceException
     */
    @RequestMapping(value="/loadAll",method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
    public Object loadGiftByAll()throws ServiceException {
        try {
            return RestResultGenerator.genSuccessResult(liveGiftService.findByParams(null));
        }catch (Exception e){
            throw new ServiceException(e.getMessage());
        }
    }
    }
